<template>
  <div>
    <div id="main" style="margin-top: 200px;height: 600px;display: flex"></div>
  </div>
</template>

<script>
import * as echarts from 'echarts'
import {baoList} from "@/api/baobiao/products";
export default {
  name: "index.vue",
  data() {
    return {

    }
  },
  methods: {
    list(){
      baoList().then(r=>{
        console.log(r.data)
        var chartDom = document.getElementById('main');
        var myChart = echarts.init(chartDom);
        var option;

        option = {
          title: {
            text: 'Referer of a Website',
            subtext: 'Fake Data',
            left: 'center'
          },
          tooltip: {
            trigger: 'item'
          },
          legend: {
            orient: 'vertical',
            left: 'left'
          },
          series: [
            {
              name: 'Access From',
              type: 'pie',
              radius: '50%',
              data:r.data,
              emphasis: {
                itemStyle: {
                  shadowBlur: 10,
                  shadowOffsetX: 0,
                  shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
              }
            }
          ]
        };

        option && myChart.setOption(option);



      })
    }
  },
  created() {
    this.list();
  }
}
</script>

<style scoped>

</style>
